class JQuery {
    constructor(selector) {
        let result = document.querySelectorAll(selector);
        for (let i = 0; i < result.length; i++) {
            this[i] = result[i];
        }
        this.length = result.length;
        this.selector = selector;
    }
    
    // 添加其他方法...
    get(index) {
        return this[index];
    }
    each(fn) {
        for (let i = 0; i < this.length; i++) {
            fn.call(null, this[i], i);
        }
    }
    on(type, fn) {
        return this.each(function(item) {
            item.addEventListener(type, fn);

        })
    }
}
//插件
JQuery.prototype.dialog = function(info) {
    alert(info);
}
//"造轮子"
class myJQuery extends JQuery {
    constructor(selector) {
        super(selector);
    }
    // 添加其他方法...
    addClass(className) {
        return this.each(function(item) {
            item.classList.add(className);
        })
    }
}